package com.cykj.user.controller;

import com.cykj.common.core.domain.R;
import com.cykj.user.domain.Customer;
import com.cykj.user.service.ICustomerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
@Tag(name = "用户管理模块")
@RestController
@RequestMapping("/auth")
public class CustomerController {

    @Autowired
    private ICustomerService customerService;

    @Operation(summary = "注册")
    @PostMapping("/register")
    public R<String> register(@RequestBody Customer customer) {
        return customerService.register(customer);
    }
    @Operation(summary = "登录")
    @PostMapping("/login")
    public R<Map<String, Object>> login(@RequestBody Customer customer) {
        return customerService.login(customer);
    }
}